package com.digiwin.muke;

import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.operators.DataSource;
import org.apache.flink.core.fs.FileSystem;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author yanggld
 * @Date 2021/04/25-17:35
 */
public class DataSetSinkApp {

    public static void main(String[] args) throws Exception {
        ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            list.add(i);
        }
        DataSource<Integer> data = env.fromCollection(list);
        String filePath = "D:\\develop\\java\\IdeaProjects\\flink-java\\src\\main\\resources\\sink.txt";
        data.writeAsText(filePath, FileSystem.WriteMode.OVERWRITE);

        env.execute("DataSetSinkApp");
    }
}
